// reducer 本质就是函数

export default function countReducer(preState = 0, action) {
  console.log('preState', preState, 'action', action);
  
  const { type, data } = action
  switch (type) {
    case 'increment':
      return preState + data
    case 'decrement':
      return preState - data
    default:
      return preState
  }
}